#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e6 + 5;

int n, m, p;
ll f[N];
void init() {
  f[0] = 1;
  rep(i, 1, n) f[i] = f[i - 1] * i % p;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t >> n >> m >> p;
  ll ans = 1;
  // c(n + 1 - m, m) * m!
  rep(i, n + 2 - m * 2, n + 1 - m) ans = ans * i % p;
  cout << ans;
  return 0;
}